home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / xemacs.info-9 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  49.8 KB  |  1,220 lines

  1. This is Info file ../../info/xemacs.info, produced by Makeinfo-1.63
  2. from the input file xemacs.texi.
  3.  
  4.    This file documents the XEmacs editor.
  5.  
  6.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
  7. 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
  8. Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
  9.  
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.  
  14.    Permission is granted to copy and distribute modified versions of
  15. this manual under the conditions for verbatim copying, provided also
  16. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  17. General Public License" are included exactly as in the original, and
  18. provided that the entire resulting derived work is distributed under the
  19. terms of a permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions, except that the sections entitled "The GNU Manifesto",
  24. "Distribution" and "GNU General Public License" may be included in a
  25. translation approved by the author instead of in the original English.
  26.  
  27. 
  28. File: xemacs.info,  Node: Outline Visibility,  Prev: Outline Motion,  Up: Outline Mode
  29.  
  30. Outline Visibility Commands
  31. ...........................
  32.  
  33.    The other special commands of outline mode are used to make lines
  34. visible or invisible.  Their names all start with `hide' or `show'.
  35. Most of them exist as pairs of opposites.  They are not undoable;
  36. instead, you can undo right past them.  Making lines visible or
  37. invisible is simply not recorded by the undo mechanism.
  38.  
  39. `M-x hide-body'
  40.      Make all body lines in the buffer invisible.
  41.  
  42. `M-x show-all'
  43.      Make all lines in the buffer visible.
  44.  
  45. `C-c C-d'
  46.      Make everything under this heading invisible, not including this
  47.      heading itself (`hide-subtree').
  48.  
  49. `C-c C-s'
  50.      Make everything under this heading visible, including body,
  51.      subheadings, and their bodies (`show-subtree').
  52.  
  53. `M-x hide-leaves'
  54.      Make the body of this heading line, and of all its subheadings,
  55.      invisible.
  56.  
  57. `M-x show-branches'
  58.      Make all subheadings of this heading line, at all levels, visible.
  59.  
  60. `C-c C-i'
  61.      Make immediate subheadings (one level down) of this heading line
  62.      visible (`show-children').
  63.  
  64. `M-x hide-entry'
  65.      Make this heading line's body invisible.
  66.  
  67. `M-x show-entry'
  68.      Make this heading line's body visible.
  69.  
  70.    Two commands that are exact opposites are `M-x hide-entry' and `M-x
  71. show-entry'.  They are used with point on a heading line, and apply
  72. only to the body lines of that heading.  The subtopics and their bodies
  73. are not affected.
  74.  
  75.    Two more powerful opposites are `C-c C-h' (`hide-subtree') and `C-c
  76. C-s' (`show-subtree').  Both should be used when point is on a heading
  77. line, and both apply to all the lines of that heading's "subtree": its
  78. body, all its subheadings, both direct and indirect, and all of their
  79. bodies.  In other words, the subtree contains everything following this
  80. heading line, up to and not including the next heading of the same or
  81. higher rank.
  82.  
  83.    Intermediate between a visible subtree and an invisible one is having
  84. all the subheadings visible but none of the body.  There are two
  85. commands for doing this, one that hides the bodies and one that makes
  86. the subheadings visible.  They are `M-x hide-leaves' and `M-x
  87. show-branches'.
  88.  
  89.    A little weaker than `show-branches' is `C-c C-i' (`show-children').
  90. It makes just the direct subheadings visible--those one level down.
  91. Deeper subheadings remain invisible.
  92.  
  93.    Two commands have a blanket effect on the whole file.  `M-x
  94. hide-body' makes all body lines invisible, so that you see just the
  95. outline structure.  `M-x show-all' makes all lines visible.  You can
  96. think of these commands as a pair of opposites even though `M-x
  97. show-all' applies to more than just body lines.
  98.  
  99.    You can turn off the use of ellipses at the ends of visible lines by
  100. setting `selective-display-ellipses' to `nil'.  The result is no
  101. visible indication of the presence of invisible lines.
  102.  
  103. 
  104. File: xemacs.info,  Node: Words,  Next: Sentences,  Prev: Text Mode,  Up: Text
  105.  
  106. Words
  107. =====
  108.  
  109.    Emacs has commands for moving over or operating on words.  By
  110. convention, the keys for them are all `Meta-' characters.
  111.  
  112. `M-f'
  113.      Move forward over a word (`forward-word').
  114.  
  115. `M-b'
  116.      Move backward over a word (`backward-word').
  117.  
  118. `M-d'
  119.      Kill up to the end of a word (`kill-word').
  120.  
  121. `M-DEL'
  122.      Kill back to the beginning of a word (`backward-kill-word').
  123.  
  124. `M-@'
  125.      Mark the end of the next word (`mark-word').
  126.  
  127. `M-t'
  128.      Transpose two words;  drag a word forward or backward across other
  129.      words (`transpose-words').
  130.  
  131.    Notice how these keys form a series that parallels the
  132. character-based `C-f', `C-b', `C-d', `C-t' and DEL.  `M-@' is related
  133. to `C-@', which is an alias for `C-SPC'.
  134.  
  135.    The commands `Meta-f' (`forward-word') and `Meta-b'
  136. (`backward-word') move forward and backward over words.  They are
  137. analogous to `Control-f' and `Control-b', which move over single
  138. characters.  Like their `Control-' analogues, `Meta-f' and `Meta-b'
  139. move several words if given an argument.  `Meta-f' with a negative
  140. argument moves backward, and `Meta-b' with a negative argument moves
  141. forward.  Forward motion stops after the last letter of the word, while
  142. backward motion stops before the first letter.
  143.  
  144.    `Meta-d' (`kill-word') kills the word after point.  To be precise,
  145. it kills everything from point to the place `Meta-f' would move to.
  146. Thus, if point is in the middle of a word, `Meta-d' kills just the part
  147. after point.  If some punctuation comes between point and the next
  148. word, it is killed along with the word.  (To kill only the next word
  149. but not the punctuation before it, simply type `Meta-f' to get to the
  150. end and kill the word backwards with `Meta-DEL'.) `Meta-d' takes
  151. arguments just like `Meta-f'.
  152.  
  153.    `Meta-DEL' (`backward-kill-word') kills the word before point.  It
  154. kills everything from point back to where `Meta-b' would move to.  If
  155. point is after the space in `FOO, BAR', then `FOO, ' is killed.   To
  156. kill just `FOO', type `Meta-b Meta-d' instead of `Meta-DEL'.
  157.  
  158.    `Meta-t' (`transpose-words') exchanges the word before or containing
  159. point with the following word.  The delimiter characters between the
  160. words do not move.  For example, transposing `FOO, BAR' results in
  161. `BAR, FOO' rather than `BAR FOO,'.  *Note Transpose::, for more on
  162. transposition and on arguments to transposition commands.
  163.  
  164.    To operate on the next N words with an operation which applies
  165. between point and mark, you can either set the mark at point and then
  166. move over the words, or you can use the command `Meta-@' (`mark-word')
  167. which does not move point but sets the mark where `Meta-f' would move
  168. to.  It can be given arguments just like `Meta-f'.
  169.  
  170.    The word commands' understanding of syntax is completely controlled
  171. by the syntax table.  For example, any character can be declared to be
  172. a word delimiter.  *Note Syntax::.
  173.  
  174. 
  175. File: xemacs.info,  Node: Sentences,  Next: Paragraphs,  Prev: Words,  Up: Text
  176.  
  177. Sentences
  178. =========
  179.  
  180.    The Emacs commands for manipulating sentences and paragraphs are
  181. mostly on `Meta-' keys, and therefore are like the word-handling
  182. commands.
  183.  
  184. `M-a'
  185.      Move back to the beginning of the sentence (`backward-sentence').
  186.  
  187. `M-e'
  188.      Move forward to the end of the sentence (`forward-sentence').
  189.  
  190. `M-k'
  191.      Kill forward to the end of the sentence (`kill-sentence').
  192.  
  193. `C-x DEL'
  194.      Kill back to the beginning of the sentence
  195.      (`backward-kill-sentence').
  196.  
  197.    The commands `Meta-a' and `Meta-e' (`backward-sentence' and
  198. `forward-sentence') move to the beginning and end of the current
  199. sentence, respectively.  They resemble `Control-a' and `Control-e',
  200. which move to the beginning and end of a line.  Unlike their
  201. counterparts, `Meta-a' and `Meta-e' move over successive sentences if
  202. repeated or given numeric arguments.  Emacs assumes the typist's
  203. convention is followed, and thus considers a sentence to end wherever
  204. there is a `.', `?', or `!' followed by the end of a line or two
  205. spaces, with any number of `)', `]', `'', or `"' characters allowed in
  206. between.  A sentence also begins or ends wherever a paragraph begins or
  207. ends.
  208.  
  209.    Neither `M-a' nor `M-e' moves past the newline or spaces beyond the
  210. sentence edge at which it is stopping.
  211.  
  212.    `M-a' and `M-e' have a corresponding kill command, just like `C-a'
  213. and `C-e' have `C-k'.  The command is  `M-k' (`kill-sentence') which
  214. kills from point to the end of the sentence.  With minus one as an
  215. argument it kills back to the beginning of the sentence.  Larger
  216. arguments serve as repeat counts.
  217.  
  218.    There is a special command, `C-x DEL' (`backward-kill-sentence'),
  219. for killing back to the beginning of a sentence, which is useful when
  220. you change your mind in the middle of composing text.
  221.  
  222.    The variable `sentence-end' controls recognition of the end of a
  223. sentence.  It is a regexp that matches the last few characters of a
  224. sentence, together with the whitespace following the sentence.  Its
  225. normal value is:
  226.  
  227.      "[.?!][]\"')]*\\($\\|\t\\|  \\)[ \t\n]*"
  228.  
  229. This example is explained in the section on regexps.  *Note Regexps::.
  230.  
  231. 
  232. File: xemacs.info,  Node: Paragraphs,  Next: Pages,  Prev: Sentences,  Up: Text
  233.  
  234. Paragraphs
  235. ==========
  236.  
  237.    The Emacs commands for manipulating paragraphs are also `Meta-' keys.
  238.  
  239. `M-['
  240.      Move back to previous paragraph beginning
  241.      (`backward-paragraph').
  242.  
  243. `M-]'
  244.      Move forward to next paragraph end (`forward-paragraph').
  245.  
  246. `M-h'
  247.      Put point and mark around this or next paragraph
  248.      (`mark-paragraph').
  249.  
  250.    `Meta-[' moves to the beginning of the current or previous paragraph,
  251. while `Meta-]' moves to the end of the current or next paragraph.
  252. Blank lines and text formatter command lines separate paragraphs and are
  253. not part of any paragraph.  An indented line starts a new paragraph.
  254.  
  255.    In major modes for programs (as opposed to Text mode), paragraphs
  256. begin and end only at blank lines.  As a result, the paragraph commands
  257. continue to be useful even though there are no paragraphs per se.
  258.  
  259.    When there is a fill prefix, paragraphs are delimited by all lines
  260. which don't start with the fill prefix.  *Note Filling::.
  261.  
  262.    To operate on a paragraph, you can use the command `Meta-h'
  263. (`mark-paragraph') to set the region around it.  This command puts
  264. point at the beginning and mark at the end of the paragraph point was
  265. in.  If point is between paragraphs (in a run of blank lines or at a
  266. boundary), the paragraph following point is surrounded by point and
  267. mark.  If there are blank lines preceding the first line of the
  268. paragraph, one of the blank lines is included in the region.  Thus, for
  269. example, `M-h C-w' kills the paragraph around or after point.
  270.  
  271.    The precise definition of a paragraph boundary is controlled by the
  272. variables `paragraph-separate' and `paragraph-start'.  The value of
  273. `paragraph-start' is a regexp that matches any line that either starts
  274. or separates paragraphs.  The value of `paragraph-separate' is another
  275. regexp that  matches only lines that separate paragraphs without being
  276. part of any paragraph.  Lines that start a new paragraph and are
  277. contained in it must match both regexps.  For example, normally
  278. `paragraph-start' is `"^[ \t\n\f]"' and `paragraph-separate' is `"^[
  279. \t\f]*$"'.
  280.  
  281.    Normally it is desirable for page boundaries to separate paragraphs.
  282. The default values of these variables recognize the usual separator for
  283. pages.
  284.  
  285. 
  286. File: xemacs.info,  Node: Pages,  Next: Filling,  Prev: Paragraphs,  Up: Text
  287.  
  288. Pages
  289. =====
  290.  
  291.    Files are often thought of as divided into "pages" by the "formfeed"
  292. character (ASCII Control-L, octal code 014).  For example, if a file is
  293. printed on a line printer, each "page" of the file starts on a new page
  294. of paper.  Emacs treats a page-separator character just like any other
  295. character.  It can be inserted with `C-q C-l' or deleted with DEL.  You
  296. are free to paginate your file or not.  However, since pages are often
  297. meaningful divisions of the file, commands are provided to move over
  298. them and operate on them.
  299.  
  300. `C-x ['
  301.      Move point to previous page boundary (`backward-page').
  302.  
  303. `C-x ]'
  304.      Move point to next page boundary (`forward-page').
  305.  
  306. `C-x C-p'
  307.      Put point and mark around this page (or another page)
  308.      (`mark-page').
  309.  
  310. `C-x l'
  311.      Count the lines in this page (`count-lines-page').
  312.  
  313.    The `C-x [' (`backward-page') command moves point to immediately
  314. after the previous page delimiter.  If point is already right after a
  315. page delimiter, the command skips that one and stops at the previous
  316. one.  A numeric argument serves as a repeat count.  The `C-x ]'
  317. (`forward-page') command moves forward past the next page delimiter.
  318.  
  319.    The `C-x C-p' command (`mark-page') puts point at the beginning of
  320. the current page and the mark at the end.  The page delimiter at the end
  321. is included (the mark follows it).  The page delimiter at the front is
  322. excluded (point follows it).  You can follow this command  by `C-w' to
  323. kill a page you want to move elsewhere.  If you insert the page after a
  324. page delimiter, at a place where `C-x ]' or `C-x [' would take you, the
  325. page will be properly delimited before and after once again.
  326.  
  327.    A numeric argument to `C-x C-p' is used to specify which page to go
  328. to, relative to the current one.  Zero means the current page.  One
  329. means the next page, and -1 means the previous one.
  330.  
  331.    The `C-x l' command (`count-lines-page') can help you decide where
  332. to break a page in two.  It prints the total number of lines in the
  333. current page in the echo area, then divides the lines into those
  334. preceding the current line and those following it, for example
  335.  
  336.      Page has 96 (72+25) lines
  337.  
  338. Notice that the sum is off by one; this is correct if point is not at
  339. the beginning of a line.
  340.  
  341.    The variable `page-delimiter' should have as its value a regexp that
  342. matches the beginning of a line that separates pages.  This defines
  343. where pages begin.  The normal value of this variable is `"^\f"', which
  344. matches a formfeed character at the beginning of a line.
  345.  
  346. 
  347. File: xemacs.info,  Node: Filling,  Next: Case,  Prev: Pages,  Up: Text
  348.  
  349. Filling Text
  350. ============
  351.  
  352.    If you use Auto Fill mode, Emacs "fills" text (breaks it up into
  353. lines that fit in a specified width) as you insert it.  When you alter
  354. existing text it is often no longer be properly filled afterwards and
  355. you can use explicit commands for filling.
  356.  
  357. * Menu:
  358.  
  359. * Auto Fill::      Auto Fill mode breaks long lines automatically.
  360. * Fill Commands:: Commands to refill paragraphs and center lines.
  361. * Fill Prefix::   Filling when every line is indented or in a comment, etc.
  362.  
  363. 
  364. File: xemacs.info,  Node: Auto Fill,  Next: Fill Commands,  Prev: Filling,  Up: Filling
  365.  
  366. Auto Fill Mode
  367. --------------
  368.  
  369.    "Auto Fill" mode is a minor mode in which lines are broken
  370. automatically when they become too wide.  Breaking happens only when
  371. you type a SPC or RET.
  372.  
  373. `M-x auto-fill-mode'
  374.      Enable or disable Auto Fill mode.
  375.  
  376. `SPC'
  377. `RET'
  378.      In Auto Fill mode, break lines when appropriate.
  379.  
  380.    `M-x auto-fill-mode' turns Auto Fill mode on if it was off, or off
  381. if it was on.  With a positive numeric argument the command always turns
  382. Auto Fill mode on, and with a negative argument it always turns it off.
  383. The presence of the word `Fill' in the mode line, inside the
  384. parentheses, indicates that Auto Fill mode is in effect.  Auto Fill mode
  385. is a minor mode; you can turn it on or off for each buffer individually.
  386. *Note Minor Modes::.
  387.  
  388.    In Auto Fill mode, lines are broken automatically at spaces when
  389. they get longer than desired.  Line breaking and rearrangement takes
  390. place only when you type SPC or RET.  To insert a space or newline
  391. without permitting line-breaking, type `C-q SPC' or `C-q LFD' (recall
  392. that a newline is really a linefeed).  `C-o' inserts a newline without
  393. line breaking.
  394.  
  395.    Auto Fill mode works well with Lisp mode: when it makes a new line in
  396. Lisp mode, it indents that line with TAB.  If a line ending in a Lisp
  397. comment gets too long, the text of the comment is split into two
  398. comment lines.  Optionally, new comment delimiters are inserted at the
  399. end of the first line and the beginning of the second, so that each line
  400. is a separate comment.  The variable `comment-multi-line' controls the
  401. choice (*note Comments::.).
  402.  
  403.    Auto Fill mode does not refill entire paragraphs.  It can break
  404. lines but cannot merge lines.  Editing in the middle of a paragraph can
  405. result in a paragraph that is not correctly filled.  The easiest way to
  406. make the paragraph properly filled again is using an explicit fill
  407. commands.
  408.  
  409.    Many users like Auto Fill mode and want to use it in all text files.
  410. The section on init files explains how you can arrange this permanently
  411. for yourself.  *Note Init File::.
  412.  
  413. 
  414. File: xemacs.info,  Node: Fill Commands,  Next: Fill Prefix,  Prev: Auto Fill,  Up: Filling
  415.  
  416. Explicit Fill Commands
  417. ----------------------
  418.  
  419. `M-q'
  420.      Fill current paragraph (`fill-paragraph').
  421.  
  422. `M-g'
  423.      Fill each paragraph in the region (`fill-region').
  424.  
  425. `C-x f'
  426.      Set the fill column (`set-fill-column').
  427.  
  428. `M-x fill-region-as-paragraph'
  429.      Fill the region, considering it as one paragraph.
  430.  
  431. `M-s'
  432.      Center a line.
  433.  
  434.    To refill a paragraph, use the command `Meta-q' (`fill-paragraph').
  435. It causes the paragraph containing point, or the one after point if
  436. point is between paragraphs, to be refilled.  All line breaks are
  437. removed, and new ones are inserted where necessary.  `M-q' can be
  438. undone with `C-_'.  *Note Undo::.
  439.  
  440.    To refill many paragraphs, use `M-g' (`fill-region'), which divides
  441. the region into paragraphs and fills each of them.
  442.  
  443.    `Meta-q' and `Meta-g' use the same criteria as `Meta-h' for finding
  444. paragraph boundaries (*note Paragraphs::.).  For more control, you can
  445. use `M-x fill-region-as-paragraph', which refills everything between
  446. point and mark.  This command recognizes only blank lines as paragraph
  447. separators.
  448.  
  449.    A numeric argument to `M-g' or `M-q' causes it to "justify" the text
  450. as well as filling it.  Extra spaces are inserted to make the right
  451. margin line up exactly at the fill column.  To remove the extra spaces,
  452. use `M-q' or `M-g' with no argument.
  453.  
  454.    The variable `auto-fill-inhibit-regexp' takes as a value a regexp to
  455. match lines that should not be auto-filled.
  456.  
  457.    The command `Meta-s' (`center-line') centers the current line within
  458. the current fill column.  With an argument, it centers several lines
  459. individually and moves past them.
  460.  
  461.    The maximum line width for filling is in the variable `fill-column'.
  462. Altering the value of `fill-column' makes it local to the current
  463. buffer; until then, the default value--initially 70--is in effect.
  464. *Note Locals::.
  465.  
  466.    The easiest way to set `fill-column' is to use the command `C-x f'
  467. (`set-fill-column').  With no argument, it sets `fill-column' to the
  468. current horizontal position of point.  With a numeric argument, it uses
  469. that number as the new fill column.
  470.  
  471. 
  472. File: xemacs.info,  Node: Fill Prefix,  Prev: Fill Commands,  Up: Filling
  473.  
  474. The Fill Prefix
  475. ---------------
  476.  
  477.    To fill a paragraph in which each line starts with a special marker
  478. (which might be a few spaces, giving an indented paragraph), use the
  479. "fill prefix" feature.  The fill prefix is a string which is not
  480. included in filling.  Emacs expects every line to start with a fill
  481. prefix.
  482.  
  483. `C-x .'
  484.      Set the fill prefix (`set-fill-prefix').
  485.  
  486. `M-q'
  487.      Fill a paragraph using current fill prefix (`fill-paragraph').
  488.  
  489. `M-x fill-individual-paragraphs'
  490.      Fill the region, considering each change of indentation as
  491.      starting a new paragraph.
  492.  
  493.    To specify a fill prefix, move to a line that starts with the desired
  494. prefix, put point at the end of the prefix, and give the command
  495. `C-x .' (`set-fill-prefix').  That's a period after the `C-x'.  To turn
  496. off the fill prefix, specify an empty prefix: type `C-x .' with point
  497. at the beginning of a line.
  498.  
  499.    When a fill prefix is in effect, the fill commands remove the fill
  500. prefix from each line before filling and insert it on each line after
  501. filling.  Auto Fill mode also inserts the fill prefix inserted on new
  502. lines it creates.  Lines that do not start with the fill prefix are
  503. considered to start paragraphs, both in `M-q' and the paragraph
  504. commands; this is just right if you are using paragraphs with hanging
  505. indentation (every line indented except the first one).  Lines which are
  506. blank or indented once the prefix is removed also separate or start
  507. paragraphs; this is what you want if you are writing multi-paragraph
  508. comments with a comment delimiter on each line.
  509.  
  510.    The fill prefix is stored in the variable `fill-prefix'.  Its value
  511. is a string, or `nil' when there is no fill prefix.  This is a
  512. per-buffer variable; altering the variable affects only the current
  513. buffer, but there is a default value which you can change as well.
  514. *Note Locals::.
  515.  
  516.    Another way to use fill prefixes is through `M-x
  517. fill-individual-paragraphs'.  This function divides the region into
  518. groups of consecutive lines with the same amount and kind of
  519. indentation and fills each group as a paragraph, using its indentation
  520. as a fill prefix.
  521.  
  522. 
  523. File: xemacs.info,  Node: Case,  Prev: Filling,  Up: Text
  524.  
  525. Case Conversion Commands
  526. ========================
  527.  
  528.    Emacs has commands for converting either a single word or any
  529. arbitrary range of text to upper case or to lower case.
  530.  
  531. `M-l'
  532.      Convert following word to lower case (`downcase-word').
  533.  
  534. `M-u'
  535.      Convert following word to upper case (`upcase-word').
  536.  
  537. `M-c'
  538.      Capitalize the following word (`capitalize-word').
  539.  
  540. `C-x C-l'
  541.      Convert region to lower case (`downcase-region').
  542.  
  543. `C-x C-u'
  544.      Convert region to upper case (`upcase-region').
  545.  
  546.    The word conversion commands are used most frequently.  `Meta-l'
  547. (`downcase-word') converts the word after point to lower case, moving
  548. past it.  Thus, repeating `Meta-l' converts successive words.  `Meta-u'
  549. (`upcase-word') converts to all capitals instead, while `Meta-c'
  550. (`capitalize-word') puts the first letter of the word into upper case
  551. and the rest into lower case.  The word conversion commands convert
  552. several words at once if given an argument.  They are especially
  553. convenient for converting a large amount of text from all upper case to
  554. mixed case: you can move through the text using `M-l', `M-u', or `M-c'
  555. on each word as appropriate, occasionally using `M-f' instead to skip a
  556. word.
  557.  
  558.    When given a negative argument, the word case conversion commands
  559. apply to the appropriate number of words before point, but do not move
  560. point.  This is convenient when you have just typed a word in the wrong
  561. case: you can give the case conversion command and continue typing.
  562.  
  563.    If a word case conversion command is given in the middle of a word,
  564. it applies only to the part of the word which follows point.  This is
  565. just like what `Meta-d' (`kill-word') does.  With a negative argument,
  566. case conversion applies only to the part of the word before point.
  567.  
  568.    The other case conversion commands are `C-x C-u' (`upcase-region')
  569. and `C-x C-l' (`downcase-region'), which convert everything between
  570. point and mark to the specified case.  Point and mark do not move.
  571.  
  572. 
  573. File: xemacs.info,  Node: Programs,  Next: Running,  Prev: Text,  Up: Top
  574.  
  575. Editing Programs
  576. ****************
  577.  
  578.    Emacs has many commands designed to understand the syntax of
  579. programming languages such as Lisp and C.  These commands can:
  580.  
  581.    * Move over or kill balanced expressions or "sexps" (*note Lists::.).
  582.  
  583.    * Move over or mark top-level balanced expressions ("defuns", in
  584.      Lisp; functions, in C).
  585.  
  586.    * Show how parentheses balance (*note Matching::.).
  587.  
  588.    * Insert, kill, or align comments (*note Comments::.).
  589.  
  590.    * Follow the usual indentation conventions of the language (*note
  591.      Grinding::.).
  592.  
  593.    The commands available for words, sentences, and paragraphs are
  594. useful in editing code even though their canonical application is for
  595. editing human language text.  Most symbols contain words (*note
  596. Words::.); sentences can be found in strings and comments (*note
  597. Sentences::.).  Paragraphs per se are not present in code, but the
  598. paragraph commands are useful anyway, because Lisp mode and C mode
  599. define paragraphs to begin and end at blank lines (*note
  600. Paragraphs::.).  Judicious use of blank lines to make the program
  601. clearer also provides interesting chunks of text for the paragraph
  602. commands to work on.
  603.  
  604.    The selective display feature is useful for looking at the overall
  605. structure of a function (*note Selective Display::.).  This feature
  606. causes only the lines that are indented less than a specified amount to
  607. appear on the screen.
  608.  
  609. * Menu:
  610.  
  611. * Program Modes::       Major modes for editing programs.
  612. * Lists::               Expressions with balanced parentheses.
  613.                          There are editing commands to operate on them.
  614. * Defuns::              Each program is made up of separate functions.
  615.                          There are editing commands to operate on them.
  616. * Grinding::            Adjusting indentation to show the nesting.
  617. * Matching::            Insertion of a close-delimiter flashes matching open.
  618. * Comments::            Inserting, illing and aligning comments.
  619. * Balanced Editing::    Inserting two matching parentheses at once, etc.
  620. * Lisp Completion::     Completion on symbol names in Lisp code.
  621. * Documentation::       Getting documentation of functions you plan to call.
  622. * Change Log::          Maintaining a change history for your program.
  623. * Tags::                Go direct to any function in your program in one
  624.                          command.  Tags remembers which file it is in.
  625. * Fortran::        Fortran mode and its special features.
  626. * Asm Mode::            Asm mode and its special features.
  627.  
  628. 
  629. File: xemacs.info,  Node: Program Modes,  Next: Lists,  Prev: Programs,  Up: Programs
  630.  
  631. Major Modes for Programming Languages
  632. =====================================
  633.  
  634.    Emacs has several major modes for the programming languages Lisp,
  635. Scheme (a variant of Lisp), C, Fortran, and Muddle.  Ideally, a major
  636. mode should be implemented for each programming language you might want
  637. to edit with Emacs; but often the mode for one language can serve for
  638. other syntactically similar languages.  The language modes that exist
  639. are those that someone decided to take the trouble to write.
  640.  
  641.    There are several variants of Lisp mode, which differ in the way they
  642. interface to Lisp execution.  *Note Lisp Modes::.
  643.  
  644.    Each of the programming language modes defines the TAB key to run an
  645. indentation function that knows the indentation conventions of that
  646. language and updates the current line's indentation accordingly.  For
  647. example, in C mode TAB is bound to `c-indent-line'.  LFD is normally
  648. defined to do RET followed by TAB; thus it, too, indents in a
  649. mode-specific fashion.
  650.  
  651.    In most programming languages, indentation is likely to vary from
  652. line to line.  So the major modes for those languages rebind DEL to
  653. treat a tab as if it were the equivalent number of spaces (using the
  654. command `backward-delete-char-untabify').  This makes it possible to
  655. rub out indentation one column at a time without worrying whether it is
  656. made up of spaces or tabs.  In these modes, use `C-b C-d' to delete a
  657. tab character before point.
  658.  
  659.    Programming language modes define paragraphs to be separated only by
  660. blank lines, so that the paragraph commands remain useful.  Auto Fill
  661. mode, if enabled in a programming language major mode, indents the new
  662. lines which it creates.
  663.  
  664.    Turning on a major mode calls a user-supplied function called the
  665. "mode hook", which is the value of a Lisp variable.  For example,
  666. turning on C mode calls the value of the variable `c-mode-hook' if that
  667. value exists and is non-`nil'.  Mode hook variables for other
  668. programming language modes include `lisp-mode-hook',
  669. `emacs-lisp-mode-hook', `lisp-interaction-mode-hook',
  670. `scheme-mode-hook', and `muddle-mode-hook'.  The mode hook function
  671. receives no arguments.
  672.  
  673. 
  674. File: xemacs.info,  Node: Lists,  Next: Defuns,  Prev: Program Modes,  Up: Programs
  675.  
  676. Lists and Sexps
  677. ===============
  678.  
  679.    By convention, Emacs keys for dealing with balanced expressions are
  680. usually `Control-Meta-' characters.  They tend to be analogous in
  681. function to their `Control-' and `Meta-' equivalents.  These commands
  682. are usually thought of as pertaining to expressions in programming
  683. languages, but can be useful with any language in which some sort of
  684. parentheses exist (including English).
  685.  
  686.    The commands fall into two classes.  Some commands deal only with
  687. "lists" (parenthetical groupings).  They see nothing except
  688. parentheses, brackets, braces (depending on what must balance in the
  689. language you are working with), and escape characters that might be used
  690. to quote those.
  691.  
  692.    The other commands deal with expressions or "sexps".  The word `sexp'
  693. is derived from "s-expression", the term for a symbolic expression in
  694. Lisp.  In Emacs, the notion of `sexp' is not limited to Lisp.  It
  695. refers to an expression in the language  your program is written in.
  696. Each programming language has its own major mode, which customizes the
  697. syntax tables so that expressions in that language count as sexps.
  698.  
  699.    Sexps typically include symbols, numbers, and string constants, as
  700. well as anything contained in parentheses, brackets, or braces.
  701.  
  702.    In languages that use prefix and infix operators, such as C, it is
  703. not possible for all expressions to be sexps.  For example, C mode does
  704. not recognize `foo + bar' as an sexp, even though it is a C expression;
  705. it recognizes `foo' as one sexp and `bar' as another, with the `+' as
  706. punctuation between them.  This is a fundamental ambiguity: both `foo +
  707. bar' and `foo' are legitimate choices for the sexp to move over if
  708. point is at the `f'.  Note that `(foo + bar)' is a sexp in C mode.
  709.  
  710.    Some languages have obscure forms of syntax for expressions that
  711. nobody has bothered to make Emacs understand properly.
  712.  
  713. `C-M-f'
  714.      Move forward over an sexp (`forward-sexp').
  715.  
  716. `C-M-b'
  717.      Move backward over an sexp (`backward-sexp').
  718.  
  719. `C-M-k'
  720.      Kill sexp forward (`kill-sexp').
  721.  
  722. `C-M-u'
  723.      Move up and backward in list structure (`backward-up-list').
  724.  
  725. `C-M-d'
  726.      Move down and forward in list structure (`down-list').
  727.  
  728. `C-M-n'
  729.      Move forward over a list (`forward-list').
  730.  
  731. `C-M-p'
  732.      Move backward over a list (`backward-list').
  733.  
  734. `C-M-t'
  735.      Transpose expressions (`transpose-sexps').
  736.  
  737. `C-M-@'
  738.      Put mark after following expression (`mark-sexp').
  739.  
  740.    To move forward over an sexp, use `C-M-f' (`forward-sexp').  If the
  741. first significant character after point is an opening delimiter (`(' in
  742. Lisp; `(', `[', or `{' in C), `C-M-f' moves past the matching closing
  743. delimiter.  If the character begins a symbol, string, or number,
  744. `C-M-f' moves over that.  If the character after point is a closing
  745. delimiter, `C-M-f' just moves past it.  (This last is not really moving
  746. across an sexp; it is an exception which is included in the definition
  747. of `C-M-f' because it is as useful a behavior as anyone can think of
  748. for that situation.)
  749.  
  750.    The command `C-M-b' (`backward-sexp') moves backward over a sexp.
  751. The detailed rules are like those above for `C-M-f', but with
  752. directions reversed.  If there are any prefix characters (single quote,
  753. back quote, and comma, in Lisp) preceding the sexp, `C-M-b' moves back
  754. over them as well.
  755.  
  756.    `C-M-f' or `C-M-b' with an argument repeats that operation the
  757. specified number of times; with a negative argument, it moves in the
  758. opposite direction.
  759.  
  760.    In languages such as C where the comment-terminator can be
  761. recognized, the sexp commands move across comments as if they were
  762. whitespace.  In Lisp and other languages where comments run until the
  763. end of a line, it is very difficult to ignore comments when parsing
  764. backwards; therefore, in such languages the sexp commands treat the
  765. text of comments as if it were code.
  766.  
  767.    Killing an sexp at a time can be done with `C-M-k' (`kill-sexp').
  768. `C-M-k' kills the characters that `C-M-f' would move over.
  769.  
  770.    The "list commands", `C-M-n' (`forward-list') and `C-M-p'
  771. (`backward-list'), move over lists like the sexp commands but skip over
  772. any number of other kinds of sexps (symbols, strings, etc).  In some
  773. situations, these commands are useful because they usually ignore
  774. comments, since the comments usually do not contain any lists.
  775.  
  776.    `C-M-n' and `C-M-p' stay at the same level in parentheses, when that
  777. is possible.  To move up one (or N) levels, use `C-M-u'
  778. (`backward-up-list').  `C-M-u' moves backward up past one unmatched
  779. opening delimiter.  A positive argument serves as a repeat count; a
  780. negative argument reverses direction of motion and also requests
  781. repetition, so it moves forward and up one or more levels.
  782.  
  783.    To move down in list structure, use `C-M-d' (`down-list').  In Lisp
  784. mode, where `(' is the only opening delimiter, this is nearly the same
  785. as searching for a `('.  An argument specifies the number of levels of
  786. parentheses to go down.
  787.  
  788.    `C-M-t' (`transpose-sexps') drags the previous sexp across the next
  789. one.  An argument serves as a repeat count, and a negative argument
  790. drags backwards (thus canceling out the effect of `C-M-t' with a
  791. positive argument).  An argument of zero, rather than doing nothing,
  792. transposes the sexps ending after point and the mark.
  793.  
  794.    To make the region be the next sexp in the buffer, use `C-M-@'
  795. (`mark-sexp') which sets the mark at the same place that `C-M-f' would
  796. move to.  `C-M-@' takes arguments like `C-M-f'.  In particular, a
  797. negative argument is useful for putting the mark at the beginning of
  798. the previous sexp.
  799.  
  800.    The list and sexp commands' understanding of syntax is completely
  801. controlled by the syntax table.  Any character can, for example, be
  802. declared to be an opening delimiter and act like an open parenthesis.
  803. *Note Syntax::.
  804.  
  805. 
  806. File: xemacs.info,  Node: Defuns,  Next: Grinding,  Prev: Lists,  Up: Programs
  807.  
  808. Defuns
  809. ======
  810.  
  811.    In Emacs, a parenthetical grouping at the top level in the buffer is
  812. called a "defun".  The name derives from the fact that most top-level
  813. lists in Lisp are instances of the special form `defun', but Emacs
  814. calls any top-level parenthetical grouping counts a defun regardless of
  815. its contents or the programming language.  For example, in C, the body
  816. of a function definition is a defun.
  817.  
  818. `C-M-a'
  819.      Move to beginning of current or preceding defun
  820.      (`beginning-of-defun').
  821.  
  822. `C-M-e'
  823.      Move to end of current or following defun (`end-of-defun').
  824.  
  825. `C-M-h'
  826.      Put region around whole current or following defun (`mark-defun').
  827.  
  828.    The commands to move to the beginning and end of the current defun
  829. are `C-M-a' (`beginning-of-defun') and `C-M-e' (`end-of-defun').
  830.  
  831.    To operate on the current defun, use `C-M-h' (`mark-defun') which
  832. puts point at the beginning and the mark at the end of the current or
  833. next defun.  This is the easiest way to prepare for moving the defun to
  834. a different place.  In C mode, `C-M-h' runs the function
  835. `mark-c-function', which is almost the same as `mark-defun', but which
  836. backs up over the argument declarations, function name, and returned
  837. data type so that the entire C function is inside the region.
  838.  
  839.    To compile and evaluate the current defun, use `M-x compile-defun'.
  840. This function prints the results in the minibuffer. If you include an
  841. argument, it inserts the value in the current buffer after the defun.
  842.  
  843.    Emacs assumes that any open-parenthesis found in the leftmost column
  844. is the start of a defun.  Therefore, never put an open-parenthesis at
  845. the left margin in a Lisp file unless it is the start of a top level
  846. list.  Never put an open-brace or other opening delimiter at the
  847. beginning of a line of C code unless it starts the body of a function.
  848. The most likely problem case is when you want an opening delimiter at
  849. the start of a line inside a string.  To avoid trouble, put an escape
  850. character (`\' in C and Emacs Lisp, `/' in some other Lisp dialects)
  851. before the opening delimiter.  It will not affect the contents of the
  852. string.
  853.  
  854.    The original Emacs found defuns by moving upward a level of
  855. parentheses until there were no more levels to go up.  This required
  856. scanning back to the beginning of the buffer for every function.  To
  857. speed this up, Emacs was changed to assume that any `(' (or other
  858. character assigned the syntactic class of opening-delimiter) at the
  859. left margin is the start of a defun.  This heuristic is nearly always
  860. right; however, it mandates the convention described above.
  861.  
  862. 
  863. File: xemacs.info,  Node: Grinding,  Next: Matching,  Prev: Defuns,  Up: Programs
  864.  
  865. Indentation for Programs
  866. ========================
  867.  
  868.    The best way to keep a program properly indented ("ground") is to
  869. use Emacs to re-indent it as you change the program.  Emacs has commands
  870. to indent properly either a single line, a specified number of lines, or
  871. all of the lines inside a single parenthetical grouping.
  872.  
  873. * Menu:
  874.  
  875. * Basic Indent::
  876. * Multi-line Indent::   Commands to reindent many lines at once.
  877. * Lisp Indent::        Specifying how each Lisp function should be indented.
  878. * C Indent::        Choosing an indentation style for C code.
  879.  
  880. 
  881. File: xemacs.info,  Node: Basic Indent,  Next: Multi-line Indent,  Prev: Grinding,  Up: Grinding
  882.  
  883. Basic Program Indentation Commands
  884. ----------------------------------
  885.  
  886. `TAB'
  887.      Adjust indentation of current line.
  888.  
  889. `LFD'
  890.      Equivalent to RET followed by TAB (`newline-and-indent').
  891.  
  892.    The basic indentation command is TAB, which gives the current line
  893. the correct indentation as determined from the previous lines.  The
  894. function that TAB runs depends on the major mode; it is
  895. `lisp-indent-line' in Lisp mode, `c-indent-line' in C mode, etc.  These
  896. functions understand different syntaxes for different languages, but
  897. they all do about the same thing.  TAB in any programming language
  898. major mode inserts or deletes whitespace at the beginning of the
  899. current line, independent of where point is in the line.  If point is
  900. inside the whitespace at the beginning of the line, TAB leaves it at
  901. the end of that whitespace; otherwise, TAB leaves point fixed with
  902. respect to the characters around it.
  903.  
  904.    Use `C-q TAB' to insert a tab at point.
  905.  
  906.    When entering a large amount of new code, use LFD
  907. (`newline-and-indent'), which is equivalent to a RET followed by a TAB.
  908. LFD creates a blank line, then gives it the appropriate indentation.
  909.  
  910.    TAB indents the second and following lines of the body of a
  911. parenthetical grouping each under the preceding one; therefore, if you
  912. alter one line's indentation to be nonstandard, the lines below tend to
  913. follow it.  This is the right behavior in cases where the standard
  914. result of TAB does not look good.
  915.  
  916.    Remember that Emacs assumes that an open-parenthesis, open-brace, or
  917. other opening delimiter at the left margin (including the indentation
  918. routines) is the start of a function.  You should therefore never have
  919. an opening delimiter in column zero that is not the beginning of a
  920. function, not even inside a string.  This restriction is vital for
  921. making the indentation commands fast. *Note Defuns::, for more
  922. information on this behavior.
  923.  
  924. 
  925. File: xemacs.info,  Node: Multi-line Indent,  Next: Lisp Indent,  Prev: Basic Indent,  Up: Grinding
  926.  
  927. Indenting Several Lines
  928. -----------------------
  929.  
  930.    Several commands are available to re-indent several lines of code
  931. which have been altered or moved to a different level in a list
  932. structure.
  933.  
  934. `C-M-q'
  935.      Re-indent all the lines within one list (`indent-sexp').
  936.  
  937. `C-u TAB'
  938.      Shift an entire list rigidly sideways so that its first line is
  939.      properly indented.
  940.  
  941. `C-M-\'
  942.      Re-indent all lines in the region (`indent-region').
  943.  
  944.    To re-indent the contents of a single list, position point before the
  945. beginning of it and type `C-M-q'. This key is bound to `indent-sexp' in
  946. Lisp mode, `indent-c-exp' in C mode, and bound to other suitable
  947. functions in other modes.  The indentation of the line the sexp starts
  948. on is not changed; therefore, only the relative indentation within the
  949. list, and not its position, is changed.  To correct the position as
  950. well, type a TAB before `C-M-q'.
  951.  
  952.    If the relative indentation within a list is correct but the
  953. indentation of its beginning is not, go to the line on which the list
  954. begins and type `C-u TAB'.  When you give TAB a numeric argument, it
  955. moves all the lines in the group, starting on the current line,
  956. sideways the same amount that the current line moves.  The command does
  957. not move lines that start inside strings, or C preprocessor lines when
  958. in C mode.
  959.  
  960.    Another way to specify a range to be re-indented is with point and
  961. mark.  The command `C-M-\' (`indent-region') applies TAB to every line
  962. whose first character is between point and mark.
  963.  
  964. 
  965. File: xemacs.info,  Node: Lisp Indent,  Next: C Indent,  Prev: Multi-line Indent,  Up: Grinding
  966.  
  967. Customizing Lisp Indentation
  968. ----------------------------
  969.  
  970.    The indentation pattern for a Lisp expression can depend on the
  971. function called by the expression.  For each Lisp function, you can
  972. choose among several predefined patterns of indentation, or define an
  973. arbitrary one with a Lisp program.
  974.  
  975.    The standard pattern of indentation is as follows: the second line
  976. of the expression is indented under the first argument, if that is on
  977. the same line as the beginning of the expression; otherwise, the second
  978. line is indented underneath the function name.  Each following line is
  979. indented under the previous line whose nesting depth is the same.
  980.  
  981.    If the variable `lisp-indent-offset' is non-`nil', it overrides the
  982. usual indentation pattern for the second line of an expression, so that
  983. such lines are always indented `lisp-indent-offset' more columns than
  984. the containing list.
  985.  
  986.    Certain functions override the standard pattern.  Functions whose
  987. names start with `def' always indent the second line by
  988. `lisp-body-indention' extra columns beyond the open-parenthesis
  989. starting the expression.
  990.  
  991.    Individual functions can override the standard pattern in various
  992. ways, according to the `lisp-indent-function' property of the function
  993. name.  (Note: `lisp-indent-function' was formerly called
  994. `lisp-indent-hook').  There are four possibilities for this property:
  995.  
  996. `nil'
  997.      This is the same as no property; the standard indentation pattern
  998.      is used.
  999.  
  1000. `defun'
  1001.      The pattern used for function names that start with `def' is used
  1002.      for this function also.
  1003.  
  1004. a number, NUMBER
  1005.      The first NUMBER arguments of the function are "distinguished"
  1006.      arguments; the rest are considered the "body" of the expression.
  1007.      A line in the expression is indented according to whether the
  1008.      first argument on it is distinguished or not.  If the argument is
  1009.      part of the body, the line is indented `lisp-body-indent' more
  1010.      columns than the open-parenthesis starting the containing
  1011.      expression.  If the argument is distinguished and is either the
  1012.      first or second argument, it is indented twice that many extra
  1013.      columns.  If the argument is distinguished and not the first or
  1014.      second argument, the standard pattern is followed for that line.
  1015.  
  1016. a symbol, SYMBOL
  1017.      SYMBOL should be a function name; that function is called to
  1018.      calculate the indentation of a line within this expression.  The
  1019.      function receives two arguments:
  1020.     STATE
  1021.           The value returned by `parse-partial-sexp' (a Lisp primitive
  1022.           for indentation and nesting computation) when it parses up to
  1023.           the beginning of this line.
  1024.  
  1025.     POS
  1026.           The position at which the line being indented begins.
  1027.  
  1028.      It should return either a number, which is the number of columns of
  1029.      indentation for that line, or a list whose first element is such a
  1030.      number.  The difference between returning a number and returning a
  1031.      list is that a number says that all following lines at the same
  1032.      nesting level should be indented just like this one; a list says
  1033.      that following lines might call for different indentations.  This
  1034.      makes a difference when the indentation is computed by `C-M-q'; if
  1035.      the value is a number, `C-M-q' need not recalculate indentation
  1036.      for the following lines until the end of the list.
  1037.  
  1038. 
  1039. File: xemacs.info,  Node: C Indent,  Prev: Lisp Indent,  Up: Grinding
  1040.  
  1041. Customizing C Indentation
  1042. -------------------------
  1043.  
  1044.    Two variables control which commands perform C indentation and when.
  1045.  
  1046.    If `c-auto-newline' is non-`nil', newlines are inserted both before
  1047. and after braces that you insert and after colons and semicolons.
  1048. Correct C indentation is done on all the lines that are made this way.
  1049.  
  1050.    If `c-tab-always-indent' is non-`nil', the TAB command in C mode
  1051. does indentation only if point is at the left margin or within the
  1052. line's indentation.  If there is non-whitespace to the left of point,
  1053. TAB just inserts a tab character in the buffer.  Normally, this
  1054. variable is `nil', and TAB always reindents the current line.
  1055.  
  1056.    C does not have anything analogous to particular function names for
  1057. which special forms of indentation are desirable.  However, it has a
  1058. different need for customization facilities: many different styles of C
  1059. indentation are in common use.
  1060.  
  1061.    There are six variables you can set to control the style that Emacs C
  1062. mode will use.
  1063.  
  1064. `c-indent-level'
  1065.      Indentation of C statements within surrounding block.  The
  1066.      surrounding block's indentation is the indentation of the line on
  1067.      which the open-brace appears.
  1068.  
  1069. `c-continued-statement-offset'
  1070.      Extra indentation given to a substatement, such as the then-clause
  1071.      of an `if' or body of a `while'.
  1072.  
  1073. `c-brace-offset'
  1074.      Extra indentation for lines that start with an open brace.
  1075.  
  1076. `c-brace-imaginary-offset'
  1077.      An open brace following other text is treated as if it were this
  1078.      far to the right of the start of its line.
  1079.  
  1080. `c-argdecl-indent'
  1081.      Indentation level of declarations of C function arguments.
  1082.  
  1083. `c-label-offset'
  1084.      Extra indentation for a line that is a label, case, or default.
  1085.  
  1086.    The variable `c-indent-level' controls the indentation for C
  1087. statements with respect to the surrounding block.  In the example:
  1088.  
  1089.          {
  1090.            foo ();
  1091.  
  1092. the difference in indentation between the lines is `c-indent-level'.
  1093. Its standard value is 2.
  1094.  
  1095.    If the open-brace beginning the compound statement is not at the
  1096. beginning of its line, the `c-indent-level' is added to the indentation
  1097. of the line, not the column of the open-brace.  For example,
  1098.  
  1099.      if (losing) {
  1100.        do_this ();
  1101.  
  1102. One popular indentation style is that which results from setting
  1103. `c-indent-level' to 8 and putting open-braces at the end of a line in
  1104. this way.  Another popular style prefers to put the open-brace on a
  1105. separate line.
  1106.  
  1107.    In fact, the value of the variable `c-brace-imaginary-offset' is
  1108. also added to the indentation of such a statement.  Normally this
  1109. variable is zero.  Think of this variable as the imaginary position of
  1110. the open brace, relative to the first non-blank character on the line.
  1111. By setting the variable to 4 and `c-indent-level' to 0, you can get
  1112. this style:
  1113.  
  1114.      if (x == y) {
  1115.          do_it ();
  1116.          }
  1117.  
  1118.    When `c-indent-level' is zero, the statements inside most braces
  1119. line up exactly under the open brace.  An exception are braces in column
  1120. zero, like those surrounding a function's body.  The statements inside
  1121. those braces are not placed at column zero.  Instead, `c-brace-offset'
  1122. and `c-continued-statement-offset' (see below) are added to produce a
  1123. typical offset between brace levels, and the statements are indented
  1124. that far.
  1125.  
  1126.    `c-continued-statement-offset' controls the extra indentation for a
  1127. line that starts within a statement (but not within parentheses or
  1128. brackets).  These lines are usually statements inside other statements,
  1129. like the then-clauses of `if' statements and the bodies of `while'
  1130. statements.  The `c-continued-statement-offset' parameter determines
  1131. the difference in indentation between the two lines in:
  1132.  
  1133.      if (x == y)
  1134.        do_it ();
  1135.  
  1136. The default value for `c-continued-statement-offset' is 2.  Some
  1137. popular indentation styles correspond to a value of zero for
  1138. `c-continued-statement-offset'.
  1139.  
  1140.    `c-brace-offset' is the extra indentation given to a line that
  1141. starts with an open-brace.  Its standard value is zero; compare:
  1142.  
  1143.      if (x == y)
  1144.        {
  1145.  
  1146. with:
  1147.  
  1148.      if (x == y)
  1149.        do_it ();
  1150.  
  1151. If you set `c-brace-offset' to 4, the first example becomes:
  1152.  
  1153.      if (x == y)
  1154.            {
  1155.  
  1156.    `c-argdecl-indent' controls the indentation of declarations of the
  1157. arguments of a C function.  It is absolute: argument declarations
  1158. receive exactly `c-argdecl-indent' spaces.  The standard value is 5 and
  1159. results in code like this:
  1160.  
  1161.      char *
  1162.      index (string, char)
  1163.           char *string;
  1164.           int char;
  1165.  
  1166.    `c-label-offset' is the extra indentation given to a line that
  1167. contains a label, a case statement, or a `default:' statement.  Its
  1168. standard value is -2 and results in code like this:
  1169.  
  1170.      switch (c)
  1171.        {
  1172.        case 'x':
  1173.  
  1174. If `c-label-offset' were zero, the same code would be indented as:
  1175.  
  1176.      switch (c)
  1177.        {
  1178.          case 'x':
  1179.  
  1180. This example assumes that the other variables above also have their
  1181. default values.
  1182.  
  1183.    Using the indentation style produced by the default settings of the
  1184. variables just discussed and putting open braces on separate lines
  1185. produces clear and readable files.  For an example, look at any of the C
  1186. source files of XEmacs.
  1187.  
  1188. 
  1189. File: xemacs.info,  Node: Matching,  Next: Comments,  Prev: Grinding,  Up: Programs
  1190.  
  1191. Automatic Display of Matching Parentheses
  1192. =========================================
  1193.  
  1194.    The Emacs parenthesis-matching feature shows you automatically how
  1195. parentheses match in the text.  Whenever a self-inserting character that
  1196. is a closing delimiter is typed, the cursor moves momentarily to the
  1197. location of the matching opening delimiter, provided that is visible on
  1198. the screen.  If it is not on the screen, some text starting with that
  1199. opening delimiter is displayed in the echo area.  Either way, you see
  1200. the grouping you are closing off.
  1201.  
  1202.    In Lisp, automatic matching applies only to parentheses.  In C, it
  1203. also applies to braces and brackets.  Emacs knows which characters to
  1204. regard as matching delimiters based on the syntax table set by the major
  1205. mode.  *Note Syntax::.
  1206.  
  1207.    If the opening delimiter and closing delimiter are mismatched--as in
  1208. `[x)'--the echo area displays a warning message.  The correct matches
  1209. are specified in the syntax table.
  1210.  
  1211.    Two variables control parenthesis matching displays.
  1212. `blink-matching-paren' turns the feature on or off. The default is `t'
  1213. (match display is on); `nil' turns it off.
  1214. `blink-matching-paren-distance' specifies how many characters back
  1215. Emacs searches to find a matching opening delimiter.  If the match is
  1216. not found in the specified region, scanning stops, and nothing is
  1217. displayed.  This prevents wasting lots of time scanning when there is no
  1218. match.  The default is 4000.
  1219.  
  1220.